<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<link rel="stylesheet" href="__PUBLIC__/Admin/css/bootstrap.min.css">
	<link rel="stylesheet" href="__PUBLIC__/Admin/css/adindex.css">
</head>
<body
	<div class="panel panel-default">
		<div class="panel-heading">
		    <h3 class="panel-title" id="M3" style="display: block;float:left"><b>行程计划</b></h3>&nbsp;&nbsp;
			<button type="button" class="plan1" class="btn btn-default btn-sm">
	          添加&nbsp;<span class="glyphicon glyphicon-edit"></span>
	        </button>
	        <button type="button" id="plan2" class="btn btn-default btn-sm">
	          返回
	        </button>
	        <form class="form-inline" style="float: right">
		        <div class="row"> 
		            <div class="input-group" style="margin-right:30px">
		               	<input type="text" class="form-control">
		                <span class="input-group-btn">
		                    <button class="btn btn-default" type="button">景点搜索</button>
		                </span>
		            </div><!-- /input-group -->
		        </div><!-- /.row -->
		    </form>
		    <br>
		    <br>
	    </div>
		<if condition="$plans eq null">
			<div class="row" id="plan3">	
				<div class="media" style="height:80px;padding:0 23%">
			    	<h3><b>没有行程安排哦!&nbsp;&nbsp; 
			   		<span class="glyphicon glyphicon-hand-right"></span>
			   		<a href="">速度开启我的行程计划</a></b></h3>
				</div>
			</div>
		<else/>
			<div class="test1">
			    <table class="table" style="margin-bottom: 50px">
				  	<thead>
				    	<tr>
				    		<th>序号</th>
					      	<th>地点</th>
					      	<th>景点</th>
					      	<th>行程日期</th>
					      	<th>人员</th>
					      	<th>操作</th>
					      	<td>状态</td>
					     </tr>
				 	 </thead>
				  <tbody>
					<foreach name="plans" item="plan">
				  	<tr class="danger">
						<td>{$plan['pid']}</td>
				      	<td>{$plan['area']}</td>
				     	<td>{$plan['spot']}</td>
				      	<td>{$plan['routime']|date="y-m-d",###}</td>
				      	<td>{$plan['people']}</td>
				      	<td>即将开始</td>
				      	<td><a href="{:U('Index/planDel',['id'=>$plan['pid']])}">删除</a>|<a type="button" name="{$plan['pid']}" class="edit">编辑</a></td>
				    </tr>
				    </foreach>
				   <!--  <tr class="success">
				   				<td>1</td>
				     	<td>北京</td>
				    	<td>故宫</td>
				     	<td>23/11/2013</td>
				     	<td>李四 张三</td>
				     	<td>计划中</td>
				     	<td><a href="#">删除</a>|<a href="#">编辑</a></td>
				   </tr>
				   <tr class="active">
				   				<td>1</td>
				     	<td>北京</td>
				    	<td>故宫</td>
				     	<td>23/11/2013</td>
				     	<td>李四 张三</td>
				     	<td>结束</td>
				     	<td><a href="#">删除</a>|<a href="#">编辑</a></td>
				    </tr> -->
				  </tbody>
				</table>
				<ul class="pagination" style="float:right;margin-right:40%;margin-top:-50px">
					{$page}
		   		</ul>
			</div>
		</if>
		<!-- 添加行程表单,隐藏div开始 -->
		<include file='planadd'/>
		<!-- 添加行程表单,隐藏div结束 -->
		</div>
	</div>
</body>
<script src="__PUBLIC__/Admin/js/jquery.min.js"></script>
<script src='__PUBLIC__/Admin/js/bootstrap.min.js'></script>
<script>
	$('.edit').click(function(){	
			$('.test1').hide();
			$('#plan3').hide();
			$('#plan4').show();
		//alert($(this).attr("name"));
		$.get('http://1766.party/index.php/Admin/Index/planUp',{id:$(this).attr("name")},function(data){
			var d = JSON.parse(data);
			//console.log($('input[name="routime"]')[0]);
			console.log(d);
			$('input[name="area"]')[0].value = d['area'];
			$('input[name="spot"]')[0].value =	d['spot'];
			$('input[name="routime"]')[0].value = d['routime'];
			$('input[name="people"]')[0].value = d['people'];
			$('#plan5')[0].action = 'http://1766.party/index.php/Admin/Index/planUp/pid/'+d['pid'];
		});
	})
</script>
</html>
